#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_up_clicked()
{
    //将label标签移动，向上，这里是将其部分进行移动
    QRect rect = ui->label->geometry();
    //修改rect
    rect.setY(rect.y()-5);
    //利用内置函数进行修改
    ui->label->setGeometry(rect);
}

void Widget::on_pushButton_left_clicked()
{
    QRect rect = ui->label->geometry();
    rect.setX(rect.x()-5);
    ui->label->setGeometry(rect);
}

void Widget::on_pushButton_down_clicked()
{
    QRect rect = ui->label->geometry();
    rect.setY(rect.y()+5);
    ui->label->setGeometry(rect);
}

void Widget::on_pushButton_right_clicked()
{
    QRect rect = ui->label->geometry();
    rect.setX(rect.x()+5);
    ui->label->setGeometry(rect);
}
